﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using System.Web.Http.Results;
using SalesSys.Comm.Utility;
using SalesSys.DAL.Models;
using SalesSys.WebCore.Authorize;
using SalesSys.WebCore;

namespace SalesSys.Site.Controllers.Api
{
    public class LoginController : ApiController
    {
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="loginName">登录名</param>
        /// <param name="md5Pw">密码</param>
        /// <param name="salt">掩码</param>
        /// <returns></returns>
        public ResultState<IEmployee> GetLogin(string loginName, string md5Pw, string salt)
        {
          var re=  ClientHelper.UserLoginAuth(null, loginName, md5Pw, salt);
            if (re)
            {
                return ReState.Success.CreateResult("", ClientHelper.ClientInfo);
            }
            return ReState.NotLogged.CreateResult<IEmployee>("登录失败", null);
        }
    }
}
